<extend name="Layout:layout_list" />
<block name="body_content_block">
    <table id="main_grid" class="easyui-treegrid" data-url="{:U('Role/get_role_list_json')}"></table>
    <div id="tb" style="padding:2px 5px;">
        <div style="margin-bottom: 5px; border-bottom:solid 1px #dddddd;">
            <a href="{:U('Role/role_edit','fid=varid')}" class="easyui-linkbutton lnk_grid_add" iconCls="icon-add" plain="true">新增</a>
            <a href="{:U('Role/role_edit','id=varid')}" class="easyui-linkbutton lnk_grid_edit lnk_edit" iconCls="icon-edit" plain="true" data-title="编辑 {role_name}">编辑</a>
            <a href="{:U('Role/role_delete','id=varid')}" class="easyui-linkbutton lnk_grid_remove lnk_remove" iconCls="icon-remove" plain="true">删除</a>
            <a href="{:U('Role/role_copy','id=varid')}" class="easyui-linkbutton lnk_grid_remove lnk_copy" iconCls="icon-copy" plain="true" data-confirm-message="您确定要复制{n}条记录吗?">复制</a>
            <a href="{:U('Role/role_permission_edit','id=varid')}" class="easyui-linkbutton lnk_grid_edit lnk_rule" iconCls="icon-edit" plain="true" data-title="权限设置 {role_name}">权限设置</a>
            <a href="#" class="easyui-linkbutton lnk_grid_reload" iconCls="icon-reload" plain="true">刷新</a>
            <a href="{:U('Role/role_export')}" class="easyui-linkbutton" iconCls="icon-save" plain="true">导出</a>
            <a href="#" class="easyui-linkbutton lnk_grid_search" iconCls="icon-search" plain="true">搜索</a>
        </div>
    </div>
</block>
<block name="body_after_block">
    <script type="text/javascript">
        // 页面初始化     
        var curd_grid = CurdGrid.newInstance();
        curd_grid.config({
            title: '角色管理',
            toolbar: '#tb',
            treeField: 'role_name',
            columns: [[
                    {field: 'ck', checkbox: true},
                    {title: "名称", field: "role_name", sortable: true},
                    {title: "次序", field: "ordinal", sortable: true},
                    {title: "时间", field: "create_time", sortable: true},
                    {title: "操作", field: "id", formatter: function (value, row) {
                            var btns = ['.lnk_edit', '.lnk_remove', '.lnk_copy', '.lnk_rule'];
                            return curd_grid.set_operatecell_buttons(btns, function (sbtn) {
                                return sbtn.replace('varid', value).replace('{role_name}', row.role_name);
                            });
                        }},
                ]],
        },{grid_mode: 'treegrid'});
        curd_grid.init();
    </script>
</block>